package com.enlorenz.core.channel.socket.common.translate;

import com.enlorenz.core.channel.common.message.imp.DataMessage;

/**
 * 消息数据转换器
 * 所有的原始byte数组全部封装到DataMessage
 * @author lcb
 */
public class DataMessageTransformer implements IMessageBytesTransformer<DataMessage>{

	@Override
	public DataMessage bytes2Message(byte[] data) {
		DataMessage byteDataMessage = new DataMessage();
		byteDataMessage.setData(data);
		return byteDataMessage;
	}

	@Override
	public byte[] message2Bytes(DataMessage message) {
		DataMessage byteDataMessage=(DataMessage)message;
		return (byte [])byteDataMessage.getData();
	}

}
